#ifndef 	__WIFI_H__
#define		__WIFI_H__	

#include "fifo.h"

#define		wifiRxFifoCount	4096
#define		wifiTxFifoCount	100



#ifndef 	_WIFI_GOLABL_
	#define		WIFI_EXTERN		extern
	EXPORT_FIFO_API(wifiTxFifo,wifiTxFifoCount, BYTE, UINT16)	
	EXPORT_FIFO_API(wifiRxFifo,wifiRxFifoCount, BYTE, UINT16)	
	
#else
	#define		WIFI_EXTERN
	NEW_FIFO(wifiTxFifo, wifiTxFifoCount, BYTE, UINT16)
	NEW_FIFO(wifiRxFifo, wifiRxFifoCount, BYTE, UINT16)
#endif

#include "def.h"
	
enum enumWifiPowerProc
{
	wifiStart = 0,
	wifiPowerOn,
	wifiSetTime,
	wifiSetTimeAck,
	wifiSetIMEI,
	wifiSetIMEIAck,
	wifiInitMode,
	wifiInitModeAck,
	wifiWaitMode,
	wifiDeployMode,
	wifiDeployModeAck,
	wifiSetDeployAttr,
	wifiSetDeployAttrAck,
	wifiGetDeployDelay,
	wifiGetDeploy,
	wifiGetDeployAck,
	wifiCollectMode,
	wifiCollectModeAck,
	wifiCollectStart,
	wifiCollectStartAck,
	wifiGetCollectDelay,
	wifiGetCollect,
	wifiGetCollectAck,
	wifiCollectEnd,
	wifiCollectEndAck,
};


enum wifiWorkMode
{
	initNoneMode = 0,
	initMode,
	deployMode,
	collectMode,
	updateMode,
};

typedef struct
{
	BOOL bCompare;
	BYTE mac[20];
	BYTE macLength;
}T_WIFI_COMPARE_INFO;

typedef struct
{
	char mac[21];
	char riss[6];
	char sum[6];
	char time[11];
}T_COLLECT_MAC_LIST;

typedef struct
{
	BOOL bWifiDeploy;
	BOOL bWifiCollect;
	BOOL bReturnATOK;
	BOOL bGSMConnect;
	BOOL bEnterUpdate;
	BOOL bStartUpdate;
	BOOL bSystemOK;
	BYTE wifiWorkMode;
	BYTE powerProcStatus;
	BYTE cmdStatus;
	BYTE cmdType;
	BYTE rxData[300];
	UINT16 rxDataLength;
	BYTE wifiFrmameBuf[300];
	UINT16 wifiFrmameLength;
	BYTE checksum;
	BYTE imei[15];
	BYTE wifiCompareIndex;
	BYTE macListCount;
	
	UINT16 cmdLengthMax;

	UINT32 wifiTimestamp;
	UINT32 getDeployDelayTimer;
	UINT32 getCollectDelayTimer;
	
	UINT32 powerProcDelayTimer;
	UINT32 debugDelayTimer;
	
	T_COLLECT_MAC_LIST collectMacListInfo[5];
	T_WIFI_COMPARE_INFO wifiCompareInfo[10];
}S_WIFI_INFO;




WIFI_EXTERN S_WIFI_INFO wifiInfo;

WIFI_EXTERN void ipcEventProcWifiComm(ULONG enumWhatEvent,ULONG lPara,BYTE *p,uint16_t length);
WIFI_EXTERN void wifiProc(void);
WIFI_EXTERN void wifiBoardInit(void);
WIFI_EXTERN void dealCommandData(u8 data);

#endif

